package com.tiantian.common.core.constraints.level;

import cn.hutool.core.util.StrUtil;
import jakarta.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidatorContext;

/**
 * @author tiantian
 */
public class CheckLevelValidator implements ConstraintValidator<CheckLevel, String> {

    @Override
    public boolean isValid(String value, ConstraintValidatorContext constraintValidatorContext) {
        // 判断level是否为0 1 2 其中一个
        return StrUtil.equalsAny(value, "0", "1", "2");
    }
}
